<!DOCTYPE html>
<html>
<head>
    

    

    



    <meta charset="utf-8">
    
    
    
    
    <title>cesium|基于dat的场景控制控件 | 一只咸鱼 | 努力学习最新姿势！！！</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content="Cesium">
    <meta name="description" content="示例   实现基于dat.GUI的场景控件 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939">
<meta property="og:type" content="article">
<meta property="og:title" content="cesium|基于dat的场景控制控件">
<meta property="og:url" content="http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/index.html">
<meta property="og:site_name" content="一只咸鱼">
<meta property="og:description" content="示例   实现基于dat.GUI的场景控件 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20200407161816693.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MDkwMjUyNw==,size_16,color_FFFFFF,t_70">
<meta property="article:published_time" content="2020-04-07T08:13:00.000Z">
<meta property="article:modified_time" content="2020-04-12T07:20:56.854Z">
<meta property="article:author" content="Mr.Zhang">
<meta property="article:tag" content="Cesium">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://img-blog.csdnimg.cn/20200407161816693.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MDkwMjUyNw==,size_16,color_FFFFFF,t_70">
    
        <link rel="alternate" type="application/atom+xml" title="一只咸鱼" href="/atom.xml">
    
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

<meta name="generator" content="Hexo 4.2.0"></head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu" class="hide" >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">Mr.Zhang</h5>
          <a href="mailto:zhangticcc@163.com" title="zhangticcc@163.com" class="mail">zhangticcc@163.com</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                首页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                时间轴
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                标签
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories"  >
                <i class="icon icon-lg icon-th-list"></i>
                分类
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://weibo.com/u/5392412243" target="_blank" >
                <i class="icon icon-lg icon-weibo"></i>
                微博
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/zhangti0708" target="_blank" >
                <i class="icon icon-lg icon-github"></i>
                开源地址
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://blog.csdn.net/weixin_40902527" target="_blank" >
                <i class="icon icon-lg icon-rss"></i>
                技术博客
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="http://zhangticcc.gitee.io/webgis/" target="_blank" >
                <i class="icon icon-lg icon-globe"></i>
                GIS案例
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://mp.weixin.qq.com/s/p4TOhKcr4RZkZWzuMYyBEQ" target="_blank" >
                <i class="icon icon-lg icon-weixin"></i>
                微信订阅号
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">cesium|基于dat的场景控制控件</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header post-header">

    <div class="container fade-scale">
        <h1 class="title">cesium|基于dat的场景控制控件</h1>
        <h5 class="subtitle">
            
                <time datetime="2020-04-07T08:13:00.000Z" itemprop="datePublished" class="page-time">
  2020-04-07
</time>


	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/GIS/">GIS</a></li></ul>

            
        </h5>
    </div>

    


</header>


<div class="container body-wrap">
    
    <aside class="post-widget">
        <nav class="post-toc-wrap post-toc-shrink" id="post-toc">
            <h4>TOC</h4>
            <ol class="post-toc"><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#示例"><span class="post-toc-number">1.</span> <span class="post-toc-text">示例</span></a></li><li class="post-toc-item post-toc-level-3"><a class="post-toc-link" href="#实现"><span class="post-toc-number">2.</span> <span class="post-toc-text">实现</span></a></li></ol>
        </nav>
    </aside>


<article id="post-cesium-基于dat的场景控制控件"
  class="post-article article-type-post fade" itemprop="blogPost">

    <div class="post-card">
        <h1 class="post-card-title">cesium|基于dat的场景控制控件</h1>
        <div class="post-meta">
            <time class="post-time" title="2020-04-07 16:13:00" datetime="2020-04-07T08:13:00.000Z"  itemprop="datePublished">2020-04-07</time>

            
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/GIS/">GIS</a></li></ul>



            
<span id="busuanzi_container_page_pv" title="文章总阅读量" style='display:none'>
    <i class="icon icon-eye icon-pr"></i><span id="busuanzi_value_page_pv"></span>
</span>


        </div>
        <div class="post-content" id="post-content" itemprop="postContent">
            <h3 id="示例"><a href="#示例" class="headerlink" title="示例"></a>示例</h3><img alt="" height="400" src="https://img-blog.csdnimg.cn/20200407161816693.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MDkwMjUyNw==,size_16,color_FFFFFF,t_70" width="700">


<h3 id="实现"><a href="#实现" class="headerlink" title="实现"></a>实现</h3><p>基于dat.GUI的场景控件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br></pre></td><td class="code"><pre><span class="line">let sceneTree &#x3D; new SceneTree(viewer);</span><br><span class="line">      let Options &#x3D; function () &#123;</span><br><span class="line">          this.fog &#x3D; true;</span><br><span class="line">          this.lighting &#x3D; false;</span><br><span class="line">          this.lensFlare &#x3D; false;</span><br><span class="line">          this.groundAtmosphere &#x3D; true;</span><br><span class="line">          this.rain &#x3D; false;</span><br><span class="line">          this.snow &#x3D; false;</span><br><span class="line">          this.sun &#x3D; true;</span><br><span class="line">          this.skyBox &#x3D; true;</span><br><span class="line">          this.globe &#x3D; true;</span><br><span class="line">          this.sbstyle &#x3D; false;</span><br><span class="line">          this.depthTestAgainstTerrain &#x3D; false;</span><br><span class="line">          this.rotation &#x3D; false;</span><br><span class="line">          this.grid &#x3D; false;</span><br><span class="line">          this.tileGrid &#x3D; false;</span><br><span class="line">          this.mgrsGrid &#x3D; false;</span><br><span class="line">          this.navi &#x3D; true;</span><br><span class="line">          this.timeLine &#x3D; false;</span><br><span class="line">          this.info &#x3D; false;</span><br><span class="line">          this.sbjk &#x3D; true;</span><br><span class="line">          this.cesiumTool &#x3D; false;</span><br><span class="line">          this.radar &#x3D; false;</span><br><span class="line">          this.province &#x3D; false;</span><br><span class="line">          this.terrain &#x3D; false;</span><br><span class="line">          this.tiles &#x3D; false;</span><br><span class="line">          this.btnCut &#x3D; function () &#123;</span><br><span class="line">              Config.cutScene(viewer);</span><br><span class="line">          &#125;;</span><br><span class="line">      &#125;</span><br><span class="line">      let option &#x3D; new Options();</span><br><span class="line">      let gui &#x3D; new dat.GUI();</span><br><span class="line">      gui.__closeButton.innerHTML &#x3D; &quot;收缩面板&quot;;</span><br><span class="line">      gui.add(option, &#39;fog&#39;).name(&quot;雾天&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;fog&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;lighting&#39;).name(&quot;昼夜&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;lighting&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;lensFlare&#39;).name(&quot;光晕&quot;).onChange(function (value) &#123;</span><br><span class="line">          lensFlare.enabled &#x3D; value;</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;groundAtmosphere&#39;).name(&quot;大气层&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;groundAtmosphere&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;rain&#39;).name(&quot;雨天&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;rain&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;snow&#39;).name(&quot;雪天&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;snow&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;sun&#39;).name(&quot;太阳&quot;).onChange(function (value) &#123;</span><br><span class="line">          viewer.scene.sun.show &#x3D; value;</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;skyBox&#39;).name(&quot;星空&quot;).onChange(function (value) &#123;</span><br><span class="line">          viewer.scene.skyBox.show &#x3D; value;</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;globe&#39;).name(&quot;地球&quot;).onChange(function (value) &#123;</span><br><span class="line">          viewer.scene.globe.show &#x3D; value;</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;sbstyle&#39;).name(&quot;鼠标十字&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;sbstyle&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;depthTestAgainstTerrain&#39;).name(&quot;深度检测&quot;).onChange(function (value) &#123;</span><br><span class="line">          viewer.scene.globe.depthTestAgainstTerrain &#x3D; value;</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;rotation&#39;).name(&quot;地球自转&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;rotation&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;grid&#39;).name(&quot;经纬网&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;grid&quot;: &#123; &quot;cmd&quot;: 1, &quot;flag&quot;: value &#125; &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;tileGrid&#39;).name(&quot;标注网格&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;grid&quot;: &#123; &quot;cmd&quot;: 2, &quot;flag&quot;: value &#125; &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;mgrsGrid&#39;).name(&quot;军事网格&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;grid&quot;: &#123; &quot;cmd&quot;: 3, &quot;flag&quot;: value &#125; &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;navi&#39;).name(&quot;导航插件&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;navi&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;timeLine&#39;).name(&quot;时间轴&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;sjz&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;sbjk&#39;).name(&quot;鼠标位置&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;xjzt&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;cesiumTool&#39;).name(&quot;内置工具&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;cesiumTool&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;radar&#39;).name(&quot;全球雷达站&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;radar&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;province&#39;).name(&quot;全国省份&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;province&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;terrain&#39;).name(&quot;地形图&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;terrain&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;tiles&#39;).name(&quot;3d瓦片&quot;).onChange(function (value) &#123;</span><br><span class="line">          sceneTree.build(&#123; &quot;_3dtiles&quot;: value &#125;);</span><br><span class="line">      &#125;)</span><br><span class="line">      gui.add(option, &#39;btnCut&#39;).name(&quot;截取场景&quot;);</span><br><span class="line">      $$(&#39;.dg.ac&#39;).css(&#39;top&#39;, &#39;10%&#39;);</span><br></pre></td></tr></table></figure>

<p>场景树封装：SceneTree</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br></pre></td><td class="code"><pre><span class="line">&#x2F;**</span><br><span class="line"> * @file sceneTree</span><br><span class="line"> * @version 1.0</span><br><span class="line"> * sceneTree 类</span><br><span class="line"> * 在3d地球上挂载场景</span><br><span class="line"> * </span><br><span class="line"> * *&#x2F;</span><br><span class="line">import &#123;CesiumTerrainProvider,EllipsoidTerrainProvider,GridImageryProvider,KmlDataSource,JulianDate,ClockRange,ClockStep,GeoJsonDataSource,</span><br><span class="line">    Cartesian3&#125; from &#39;cesium&#39;</span><br><span class="line">import Rain from &#39;.&#x2F;libs&#x2F;rain&#39;;</span><br><span class="line">import Snow from &#39;.&#x2F;libs&#x2F;snow&#39;;</span><br><span class="line">let _self;</span><br><span class="line">export default class sceneTree &#123;</span><br><span class="line"></span><br><span class="line">    constructor(core) &#123;</span><br><span class="line">        &#x2F;**</span><br><span class="line">         * root 节点</span><br><span class="line">         *&#x2F;</span><br><span class="line">        this.root &#x3D; null;</span><br><span class="line">        &#x2F;**</span><br><span class="line">         * viewer</span><br><span class="line">         *&#x2F;</span><br><span class="line">        this.viewer &#x3D; core;</span><br><span class="line">        &#x2F;**</span><br><span class="line">       * 场景</span><br><span class="line">       *&#x2F;</span><br><span class="line">        this.S &#x3D; core.scene;</span><br><span class="line"></span><br><span class="line">        &#x2F;&#x2F;辅助对象</span><br><span class="line">        _self &#x3D; this;</span><br><span class="line">        &#x2F;**</span><br><span class="line">         * 状态码</span><br><span class="line">         *&#x2F;</span><br><span class="line">        this.STATUS &#x3D; &#123;</span><br><span class="line">            CREATE: &quot;No&quot;,</span><br><span class="line">            CLOSE: &quot;Off&quot;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    &#x2F;**</span><br><span class="line">     * build 接口</span><br><span class="line">     *&#x2F;</span><br><span class="line">    build(trees) &#123;</span><br><span class="line">        if (trees &#x3D;&#x3D; undefined) &#123;</span><br><span class="line">            alert(&quot;没有获取到功能节点&quot;);</span><br><span class="line">        &#125;</span><br><span class="line">        let _self &#x3D; this;</span><br><span class="line">        &#x2F;&#x2F;自转</span><br><span class="line">        if (trees.rotation !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees.rotation) &#123;</span><br><span class="line">                this.rotation(&#123; cmd: &quot;No&quot; &#125;);</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                this.rotation(&#123; cmd: &quot;Off&quot; &#125;);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;雾天</span><br><span class="line">        if (trees.fog !&#x3D; undefined) &#123;</span><br><span class="line">            this.S.fog.enabled &#x3D; trees.fog;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;昼夜</span><br><span class="line">        if (trees.lighting !&#x3D; undefined) &#123;</span><br><span class="line">            this.S.globe.enableLighting &#x3D; trees.lighting;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;大气层</span><br><span class="line">        if (trees.groundAtmosphere !&#x3D; undefined) &#123;</span><br><span class="line">            this.S.globe.showGroundAtmosphere &#x3D; trees.groundAtmosphere;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;地球</span><br><span class="line">        if (trees.globe !&#x3D; undefined) &#123;</span><br><span class="line">            this.S.globe.show &#x3D; trees.globe;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;星空</span><br><span class="line">        if (trees.skyBox !&#x3D; undefined) &#123;</span><br><span class="line">            this.S.skyBox.show &#x3D; true;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;太阳</span><br><span class="line">        if (trees.sun !&#x3D; undefined) &#123;</span><br><span class="line">            this.S.sun.show &#x3D; trees.sun;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;雨天</span><br><span class="line">        if (trees.rain !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees.rain) &#123;</span><br><span class="line">                setTimeout(()&#x3D;&gt; &#123;</span><br><span class="line">                    this._rain &#x3D; new Rain(this.viewer);</span><br><span class="line">                &#125;, 100)</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                this._rain.remove();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;雪天</span><br><span class="line">        if (trees.snow !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees.snow) &#123;</span><br><span class="line">                setTimeout( ()&#x3D;&gt; &#123;</span><br><span class="line">                    this._snow&#x3D; new Snow(this.viewer);</span><br><span class="line">                &#125;, 100)</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                this._snow.remove();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;经纬网</span><br><span class="line">        if (trees.grid !&#x3D; undefined) &#123;</span><br><span class="line">            if (1 &#x3D;&#x3D; trees.grid.cmd) &#123;</span><br><span class="line">                if (trees.grid.flag) &#123;</span><br><span class="line">                    this.scene.grid(&#123; cmd: &quot;No&quot; &#125;);</span><br><span class="line">                &#125; else &#123;</span><br><span class="line">                    this.scene.grid(&#123; cmd: &quot;Off&quot; &#125;);</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            if (2 &#x3D;&#x3D; trees.grid.cmd) &#123;</span><br><span class="line">                if (trees.grid.flag) &#123;</span><br><span class="line">                    this.scene.tileGrid(&#123; cmd: &quot;No&quot; &#125;);</span><br><span class="line">                &#125; else &#123;</span><br><span class="line">                    this.scene.tileGrid(&#123; cmd: &quot;Off&quot; &#125;);</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            if (3 &#x3D;&#x3D; trees.grid.cmd) &#123;</span><br><span class="line">                if (trees.grid.flag) &#123;</span><br><span class="line">                    this.scene.mgrsGrid(&#123; cmd: &quot;No&quot; &#125;);</span><br><span class="line">                &#125; else &#123;</span><br><span class="line">                    this.scene.mgrsGrid(&#123; cmd: &quot;Off&quot; &#125;);</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;十字</span><br><span class="line">        if (trees.sbstyle !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees.sbstyle) &#123;</span><br><span class="line">                document.documentElement.style.cursor &#x3D; &#39;crosshair&#39;;</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                document.documentElement.style.cursor &#x3D; &#39;default&#39;;</span><br><span class="line">            &#125;</span><br><span class="line"></span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;相机状态</span><br><span class="line">        if (trees.xjzt !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees.xjzt) &#123;</span><br><span class="line">                $$(&#39;.map-move-msg&#39;).show();</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                $$(&#39;.map-move-msg&#39;).hide();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;cesiumTool</span><br><span class="line">        if (trees.cesiumTool !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees.cesiumTool) &#123;</span><br><span class="line">                $$(&#39;.cesium-viewer-toolbar&#39;).show();</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                $$(&#39;.cesium-viewer-toolbar&#39;).hide();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;时间轴</span><br><span class="line">        if (trees.sjz !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees.sjz) &#123;</span><br><span class="line">                this.showTime();</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                this.hideTime();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;信息框</span><br><span class="line">        if (trees.info !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees.info) &#123;</span><br><span class="line">                $$(&#39;.cesium-infoBox&#39;).show();</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                $$(&#39;.cesium-infoBox&#39;).hide();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;导航</span><br><span class="line">        if (trees.navi !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees.navi) &#123;</span><br><span class="line">                $$(&#39;.cesium-widget-cesiumNavigationContainer&#39;).show();</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                $$(&#39;.cesium-widget-cesiumNavigationContainer&#39;).hide();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;雷达</span><br><span class="line">        if (trees.radar !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees.radar) &#123;</span><br><span class="line">                this.radar &#x3D; new Radar(&#123; viewer: this.viewer &#125;);</span><br><span class="line">                this.radar.build(4)</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                if (!this.radar) return;</span><br><span class="line">                this.radar.dmRadar.remove();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;省份数据</span><br><span class="line">        if (trees.province !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees.province) &#123;</span><br><span class="line">                this.createProvincesBorder();</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                this.closeProvincesBorder();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;3dtile</span><br><span class="line">        if (trees._3dtiles !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees._3dtiles) &#123;</span><br><span class="line">                this.primitive.create3DTileset(&#123; url: config.DATADIR + &#39;&#x2F;3DTiles&#x2F;building&#x2F;tileset.json&#39; &#125;);</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                this.primitive.remove3DTileset();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;地形</span><br><span class="line">        if (trees.terrain !&#x3D; undefined) &#123;</span><br><span class="line">            if (trees.terrain) &#123;</span><br><span class="line">                try &#123;</span><br><span class="line">                    &#x2F;&#x2F;this.viewer.scene.terrainProvider &#x3D; createArcGisElevation3DTerrainProvider(Cesium);</span><br><span class="line">                    this.viewer.scene.terrainProvider &#x3D; new CesiumTerrainProvider(&#123;</span><br><span class="line">                        url: &quot;&#x2F;chinadem&#x2F;&quot;</span><br><span class="line">                    &#125;)</span><br><span class="line">                &#125; catch (error) &#123;</span><br><span class="line">                    alert(&quot;默认地形图加载异常&quot;);</span><br><span class="line">                &#125;</span><br><span class="line">            &#125; else &#123;</span><br><span class="line">                this.viewer.scene.terrainProvider &#x3D; new EllipsoidTerrainProvider(&#123;&#125;);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line">    &#x2F;**</span><br><span class="line">     * --------</span><br><span class="line">     * 辅助方法</span><br><span class="line">     * --------</span><br><span class="line">     *&#x2F;</span><br><span class="line">    &#x2F;**</span><br><span class="line">    * 地球自转</span><br><span class="line">    *&#x2F;</span><br><span class="line">    rotate() &#123;</span><br><span class="line">        let a &#x3D; .1;</span><br><span class="line">        let t &#x3D; Date.now();</span><br><span class="line">        let n &#x3D; (t - _self._rota) &#x2F; 1e3;</span><br><span class="line">        _self._rota &#x3D; t;</span><br><span class="line">        _self.S.camera.rotate(Cartesian3.UNIT_Z, -a * n);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    rotation(opt) &#123;</span><br><span class="line">        if (opt.cmd &#x3D;&#x3D; _self.STATUS.CREATE) &#123;</span><br><span class="line">            _self._rota &#x3D; Date.now();</span><br><span class="line">            _self.CoreV.clock.onTick.addEventListener(_self.rotate);</span><br><span class="line">        &#125;</span><br><span class="line">        if (opt.cmd &#x3D;&#x3D; _self.STATUS.CLOSE) &#123;</span><br><span class="line">            _self.CoreV.clock.onTick.removeEventListener(_self.rotate);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    &#x2F;**</span><br><span class="line">    * 经纬网</span><br><span class="line">    *&#x2F;</span><br><span class="line">    grid(opt) &#123;</span><br><span class="line">        let _self &#x3D; this;</span><br><span class="line">        if (opt.cmd &#x3D;&#x3D; _self.STATUS.CREATE) &#123;</span><br><span class="line">            let mapGrid &#x3D; new GridImageryProvider();</span><br><span class="line">            _self.layerGrid &#x3D; _self.imageryLayers.addImageryProvider(mapGrid);&#x2F;&#x2F;添加注记图层</span><br><span class="line">            &#x2F;&#x2F;_self.imageryLayers.grid.data &#x3D; layer;</span><br><span class="line">            _self.imageryLayers.raiseToTop(_self.layerGrid);       &#x2F;&#x2F;将注记图层置顶</span><br><span class="line">        &#125;</span><br><span class="line">        if (opt.cmd &#x3D;&#x3D; _self.STATUS.CLOSE) &#123;</span><br><span class="line">            _self.imageryLayers.remove(_self.layerGrid);</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;return _self.layer;</span><br><span class="line">    &#125;</span><br><span class="line">    &#x2F;**</span><br><span class="line">    * 经纬网2</span><br><span class="line">    *&#x2F;</span><br><span class="line">    tileGrid(opt) &#123;</span><br><span class="line">        let _self &#x3D; this;</span><br><span class="line">        if (opt.cmd &#x3D;&#x3D; _self.STATUS.CREATE) &#123;</span><br><span class="line">            let mapGrid &#x3D; new TileLonlatsImageryProvider();</span><br><span class="line">            _self.layerTileGrid &#x3D; _self.imageryLayers.addImageryProvider(mapGrid);&#x2F;&#x2F;添加注记图层</span><br><span class="line">            &#x2F;&#x2F;_self.imageryLayers.grid.data &#x3D; layer;</span><br><span class="line">            _self.imageryLayers.raiseToTop(_self.layerTileGrid);       &#x2F;&#x2F;将注记图层置顶</span><br><span class="line">        &#125;</span><br><span class="line">        if (opt.cmd &#x3D;&#x3D; _self.STATUS.CLOSE) &#123;</span><br><span class="line">            _self.imageryLayers.remove(_self.layerTileGrid);</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F; return _self.layer;</span><br><span class="line">    &#125;</span><br><span class="line">    &#x2F;**</span><br><span class="line">    * 军事网格</span><br><span class="line">    *&#x2F;</span><br><span class="line">    mgrsGrid(opt) &#123;</span><br><span class="line">        let _self &#x3D; this;</span><br><span class="line">        if (opt.cmd &#x3D;&#x3D; _self.STATUS.CREATE) &#123;</span><br><span class="line">            var options &#x3D; &#123; camera: this.S.camera, canvas: this.S.canvas &#125;;</span><br><span class="line">            let pn &#x3D; KmlDataSource.load(&quot;data&#x2F;EarthPointGrid_093357.kml&quot;, options);</span><br><span class="line">            pn.then(function (dataSource) &#123;</span><br><span class="line">                _self.xmlData &#x3D; dataSource;</span><br><span class="line">                _self.CoreV.dataSources.add(_self.xmlData);</span><br><span class="line">            &#125;);</span><br><span class="line">        &#125;</span><br><span class="line">        if (opt.cmd &#x3D;&#x3D; _self.STATUS.CLOSE) &#123;</span><br><span class="line">            _self.CoreV.dataSources.remove(_self.xmlData);</span><br><span class="line">        &#125;</span><br><span class="line">        &#x2F;&#x2F;return _self.xmlData;</span><br><span class="line">    &#125;</span><br><span class="line">    &#x2F;**</span><br><span class="line">     * 日照分析</span><br><span class="line">     *&#x2F;</span><br><span class="line">   </span><br><span class="line">    &#x2F;&#x2F;显示动画时间轴</span><br><span class="line">    showTime() &#123;</span><br><span class="line">        if ($$(&#39;.map-move-msg&#39;).css(&#39;display&#39;) &#x3D;&#x3D; &#39;none&#39;) &#123;</span><br><span class="line">            $$(&#39;.cesium-viewer-animationContainer&#39;).css(&#39;bottom&#39;, 0 + &#39;px&#39;);</span><br><span class="line">            $$(&#39;.cesium-viewer-timelineContainer&#39;).css(&#39;bottom&#39;, 0 + &#39;px&#39;);</span><br><span class="line">        &#125; else &#123;</span><br><span class="line">            $$(&#39;.cesium-viewer-animationContainer&#39;).css(&#39;bottom&#39;, $$(&#39;.map-move-msg&#39;).height() + &#39;px&#39;);</span><br><span class="line">            $$(&#39;.cesium-viewer-timelineContainer&#39;).css(&#39;bottom&#39;, $$(&#39;.map-move-msg&#39;).height() + &#39;px&#39;);</span><br><span class="line">        &#125;</span><br><span class="line">        $$(&#39;.cesium-viewer-animationContainer&#39;).show();</span><br><span class="line">        $$(&#39;.cesium-viewer-timelineContainer&#39;).show();</span><br><span class="line">    &#125;</span><br><span class="line">    &#x2F;&#x2F;隐藏动画时间轴</span><br><span class="line">    hideTime() &#123;</span><br><span class="line">        $$(&#39;.cesium-viewer-animationContainer&#39;).hide();</span><br><span class="line">        $$(&#39;.cesium-viewer-timelineContainer&#39;).hide();</span><br><span class="line">    &#125;</span><br><span class="line">    &#x2F;&#x2F;省份数据</span><br><span class="line">    createProvincesBorder() &#123;</span><br><span class="line">        let _self &#x3D; this;</span><br><span class="line">        var promise &#x3D; _self.viewer.dataSources.add(GeoJsonDataSource.load(config.DATADIR + &#39;&#x2F;china.json&#39;));</span><br><span class="line">        promise.then(function (dataSource) &#123;</span><br><span class="line">            _self.provinceData &#x3D; dataSource;</span><br><span class="line">        &#125;).otherwise(function (error) &#123;</span><br><span class="line">            return new Errors(error);</span><br><span class="line">        &#125;);</span><br><span class="line">    &#125;</span><br><span class="line">    &#x2F;&#x2F;清除数据</span><br><span class="line">    closeProvincesBorder() &#123;</span><br><span class="line">        this.viewer.dataSources.remove(this.provinceData);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>



        </div>

        <blockquote class="post-copyright">
    
    <div class="content">
        
<span class="post-time">
    最后更新时间：<time datetime="2020-04-12T07:20:56.854Z" itemprop="dateUpdated">2020-04-12 15:20:56</time>
</span><br>


        
        这里可以写作者留言，标签和 hexo 中所有变量及辅助函数等均可调用，示例：<a href="/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/" target="_blank" rel="external">http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/</a>
        
    </div>
    
    <footer>
        <a href="http://yoursite.com">
            <img src="/img/avatar.jpg" alt="Mr.Zhang">
            Mr.Zhang
        </a>
    </footer>
</blockquote>

        
<div class="page-reward">
    <a id="rewardBtn" href="javascript:;" class="page-reward-btn waves-effect waves-circle waves-light">赏</a>
</div>



        <div class="post-footer">
            
	<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Cesium/" rel="tag">Cesium</a></li></ul>


            
<div class="page-share-wrap">
    

<div class="page-share" id="pageShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/&title=《cesium|基于dat的场景控制控件》 — 一只咸鱼&pic=http://yoursite.com/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/&title=《cesium|基于dat的场景控制控件》 — 一只咸鱼&source=分享各种福利和姿势..." data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《cesium|基于dat的场景控制控件》 — 一只咸鱼&url=http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/&via=http://yoursite.com" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>



    <a href="javascript:;" id="shareFab" class="page-share-fab waves-effect waves-circle">
        <i class="icon icon-share-alt icon-lg"></i>
    </a>
</div>



        </div>
    </div>

    
<nav class="post-nav flex-row flex-justify-between">
  
    <div class="waves-block waves-effect prev">
      <a href="/2020/04/07/cesium-%E4%B8%89%E7%BB%B4%E9%A3%8E%E5%9C%BA%E6%8F%92%E4%BB%B6/" id="post-prev" class="post-nav-link">
        <div class="tips"><i class="icon icon-angle-left icon-lg icon-pr"></i> Prev</div>
        <h4 class="title">cesium|三维风场插件</h4>
      </a>
    </div>
  

  
    <div class="waves-block waves-effect next">
      <a href="/2020/04/07/cesium-%E6%A8%A1%E6%8B%9F%E6%89%AB%E6%8F%8F%E7%89%A9%E5%AE%9E%E4%BD%93%E5%8A%9F%E8%83%BD/" id="post-next" class="post-nav-link">
        <div class="tips">Next <i class="icon icon-angle-right icon-lg icon-pl"></i></div>
        <h4 class="title">cesium|模拟扫描物实体功能</h4>
      </a>
    </div>
  
</nav>



    




















</article>

<div id="reward" class="page-modal reward-lay">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <h3 class="reward-title">
        <i class="icon icon-quote-left"></i>
        谢谢大爷~
        <i class="icon icon-quote-right"></i>
    </h3>
    <div class="reward-content">
        
        <div class="reward-code">
            <img id="rewardCode" src="/img/wechat.jpg" alt="打赏二维码">
        </div>
        
        <label class="reward-toggle">
            <input id="rewardToggle" type="checkbox" class="reward-toggle-check"
                data-wechat="/img/wechat.jpg" data-alipay="/img/alipay.jpg">
            <div class="reward-toggle-ctrol">
                <span class="reward-toggle-item wechat">微信</span>
                <span class="reward-toggle-label"></span>
                <span class="reward-toggle-item alipay">支付宝</span>
            </div>
        </label>
        
    </div>
</div>



</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
                <span><a href="/atom.xml" target="_blank" class="rss" title="rss"><i class="icon icon-lg icon-rss"></i></a></span>
            
            <span>博客内容遵循 <a rel="license noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>Mr.Zhang &copy; 2015 - 2020</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/&title=《cesium|基于dat的场景控制控件》 — 一只咸鱼&pic=http://yoursite.com/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/&title=《cesium|基于dat的场景控制控件》 — 一只咸鱼&source=分享各种福利和姿势..." data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=《cesium|基于dat的场景控制控件》 — 一只咸鱼&url=http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/&via=http://yoursite.com" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="//api.qrserver.com/v1/create-qr-code/?data=http://yoursite.com/2020/04/07/cesium-%E5%9F%BA%E4%BA%8Edat%E7%9A%84%E5%9C%BA%E6%99%AF%E6%8E%A7%E5%88%B6%E6%8E%A7%E4%BB%B6/" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: true };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>






<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>



<script>
(function() {
    var OriginTitile = document.title, titleTime;
    document.addEventListener('visibilitychange', function() {
        if (document.hidden) {
            document.title = '死鬼去哪里了！';
            clearTimeout(titleTime);
        } else {
            document.title = '(つェ⊂)咦!又好了!';
            titleTime = setTimeout(function() {
                document.title = OriginTitile;
            },2000);
        }
    });
})();
</script>



</body>
</html>
